package com.huakang.service.impl;

import com.huakang.entity.Inpatient;
import com.huakang.mapper.InpatientMapper;
import com.huakang.service.InpatientService;
import com.huakang.utils.InpatientVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class InpatientServiceImpl implements InpatientService {
    @Autowired
    InpatientMapper inpatientMapper;

    @Override
    public boolean insert(Inpatient inpatient) {
        return inpatientMapper.insertSelective(inpatient)>0?true:false;
    }

    @Override
    public List<InpatientVo> getAll() {
        return inpatientMapper.select();
    }

    @Override
    public List<InpatientVo> getSearch(String name) {
        return inpatientMapper.selectSearch(name);
    }

    @Override
    public InpatientVo getInpid(Integer inpid) {
        return inpatientMapper.selectInpid(inpid);
    }


    @Override
    public boolean remo(Integer inpid) {
        return inpatientMapper.deleteByPrimaryKey(inpid)>0?true:false;
    }

    @Override
    public Inpatient getPid(Integer pid) {
        return inpatientMapper.selectPid(pid);
    }

    @Override
    public boolean update(Inpatient inpatient) {
        return inpatientMapper.updateByPrimaryKeySelective(inpatient)>0?true:false;
    }
}
